<html>
<head><meta charset="utf-8"><title>Differences between tree and metadata commands · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html">Differences between tree and metadata commands</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="210206895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210206895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210206895">(Sep 15 2020 at 23:56)</a>:</h4>
<p>Can someone help me figure out why the outputs of <code>cargo metadata</code> differs from <code>cargo tree</code> in what dependencies are specified in the output? I made a repo to better demonstrate this: <a href="https://github.com/UebelAndre/cargo-metadata-test">https://github.com/UebelAndre/cargo-metadata-test</a></p>



<a name="210207930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210207930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210207930">(Sep 16 2020 at 00:08)</a>:</h4>
<p>Thank you for the reproduction. Can you be more specific about exactly what<br>
parts of the output seem to differ?</p>



<a name="210208830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210208830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210208830">(Sep 16 2020 at 00:21)</a>:</h4>
<p>Hey, yeah, there doesn't seem to be any mention of the <code>wasm-bindgen-cli</code> package in the metadata</p>



<a name="210208846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210208846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210208846">(Sep 16 2020 at 00:21)</a>:</h4>
<p>And that's the thing I care about most</p>



<a name="210208922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210208922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210208922">(Sep 16 2020 at 00:22)</a>:</h4>
<p><span class="user-mention" data-user-id="120179">@Eh2406</span> for extra context I'm trying to find a solution for <a href="https://github.com/google/cargo-raze/issues/218">https://github.com/google/cargo-raze/issues/218</a></p>



<a name="210209006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210209006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210209006">(Sep 16 2020 at 00:23)</a>:</h4>
<p>I spent some time trying to figure out what was different between <code>tree</code> and <code>metadata</code> since <code>tree</code>, being similar to <code>metadata</code> shows <code>wasm-bindgen-cli</code></p>



<a name="210209104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210209104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210209104">(Sep 16 2020 at 00:24)</a>:</h4>
<p>But yeah, why doesn't <code>wasm-bindgen-cli</code> show up in the <code>packages</code> list in <a href="https://github.com/UebelAndre/cargo-metadata-test/blob/master/metadata.json#L2">https://github.com/UebelAndre/cargo-metadata-test/blob/master/metadata.json#L2</a> ?</p>



<a name="210210920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210210920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210210920">(Sep 16 2020 at 00:54)</a>:</h4>
<p><span class="user-mention" data-user-id="120179">@Eh2406</span> any ideas?</p>



<a name="210211178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210211178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210211178">(Sep 16 2020 at 00:58)</a>:</h4>
<p>Sorry for the delay, just got back from my walk.</p>



<a name="210212093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210212093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210212093">(Sep 16 2020 at 01:14)</a>:</h4>
<p>Others will know more, as Alex is listed as the primary contributor to <code>wasm-bindgen-cli</code> :-) .  But my guess is that it has to do with the fact that <code>wasm-bindgen-cli</code> is a binary not a library. It is not clear in the current semantics of Cargo.toml what it means to depend on a binary. I think Josh was beginning to work on specifying that. Eric impled the cargos version of tree, so may have an opinion on which output is more correct.</p>



<a name="210212534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210212534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210212534">(Sep 16 2020 at 01:23)</a>:</h4>
<p>I think <code>metadata</code> may be more correct. When I run <code>cargo check</code> <code>docopt</code> is not built matching the <code>metadata</code> output.</p>



<a name="210213597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210213597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210213597">(Sep 16 2020 at 01:44)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120179">Eh2406</span> <a href="#narrow/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands/near/210212093">said</a>:</p>
<blockquote>
<p>It is not clear in the current semantics of Cargo.toml what it means to depend on a binary. I think Josh was beginning to work on specifying that.</p>
</blockquote>
<p>I wrote it up in the comments of one of the relevant issues, but someone needs to turn that into an RFC.</p>



<a name="210216161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210216161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210216161">(Sep 16 2020 at 02:37)</a>:</h4>
<p>Is there a way to get the metadata for binaries I'm depending on?</p>



<a name="210216227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210216227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210216227">(Sep 16 2020 at 02:38)</a>:</h4>
<p>I didn't think it would matter if my dependency was a library or a binary. My expectation is that by listing it as a dependency, <code>cargo metadata</code> would include it in the list of packages in the resulting json. After all, binaries are still packages, right?</p>



<a name="210217424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210217424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210217424">(Sep 16 2020 at 03:01)</a>:</h4>
<p>That is an excellent question, hopefully Eric well be able to help.</p>
<p>On a different note, why are you depending on a binary crate? You can't be<br>
planning to 'use ' it from your code, as it's not a library so you can't<br>
important it. You can't be planning to use the resulting executable, as it<br>
does not get built so won't be available.</p>



<a name="210265871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210265871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210265871">(Sep 16 2020 at 14:03)</a>:</h4>
<p>Cargo doesn't really support binary dependencies. It probably should print a warning if it finds one. <code>cargo metadata</code> specifically filters them out, I don't think there is a way to access them.</p>



<a name="210280860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210280860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210280860">(Sep 16 2020 at 15:44)</a>:</h4>
<p>Thanks <span class="user-mention" data-user-id="120518">@Eric Huss</span> Is there a way to get the metadata of binary dependencies without having to clone the repo or something? Example: <code>cargo metadata --target wasm-bindgen-cli</code>?</p>



<a name="210281366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210281366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210281366">(Sep 16 2020 at 15:47)</a>:</h4>
<p>I don't think there is a way to access them.</p>



<a name="210284919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210284919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210284919">(Sep 16 2020 at 16:13)</a>:</h4>
<p>Is there a way to get metadata for an arbitrary package?</p>



<a name="210285021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210285021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210285021">(Sep 16 2020 at 16:14)</a>:</h4>
<p>Why do you need metadata data for a dependency you can't use?</p>



<a name="210286336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210286336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210286336">(Sep 16 2020 at 16:24)</a>:</h4>
<p>That's a question with a kinda long answer, but in short: The <code>cargo-raze</code> tool uses metadata to build a dependency tree and generate build targets for the Bazel build system. The way it's implemented right now is to look at the dependencies in a <code>Cargo.toml</code> file and generate a target for each dependency such that you can build your final target. But, what if the target you want to generate is a binary? There's currently no way to generate a binary target because they omitted from your packages metadata.</p>



<a name="210286930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210286930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210286930">(Sep 16 2020 at 16:29)</a>:</h4>
<p><a href="https://github.com/bazelbuild/rules_rust/blob/master/wasm_bindgen/raze/Cargo.toml">https://github.com/bazelbuild/rules_rust/blob/master/wasm_bindgen/raze/Cargo.toml</a> this is the specific use case</p>



<a name="210287077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210287077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210287077">(Sep 16 2020 at 16:30)</a>:</h4>
<p>we want to be able to compile the <code>wasm-bindgen-cli</code> target using Bazel in a way that the binary can be used in other targets/rules</p>



<a name="210287203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210287203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210287203">(Sep 16 2020 at 16:31)</a>:</h4>
<p>now that <code>cargo-raze</code> is using <code>cargo_metadata</code>, it no longer gets metadata for the <code>wasm-bindgen-cli</code> target</p>



<a name="210287225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210287225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210287225">(Sep 16 2020 at 16:31)</a>:</h4>
<p>which means we can no longer update this tool</p>



<a name="210287484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210287484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210287484">(Sep 16 2020 at 16:33)</a>:</h4>
<p>Did I explain that well enough?  I know I'm bad at explanations <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="210287653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210287653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210287653">(Sep 16 2020 at 16:35)</a>:</h4>
<p>if you check out <code>wasm-bindgen-cli</code> and run cargo metadata, you will get what you want. If you depend on <code>wasm-bindgen-cli</code> then cargo will not do anything helpful when it builds that depender so cargo metadata does not tell you about it.</p>



<a name="210288103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210288103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210288103">(Sep 16 2020 at 16:38)</a>:</h4>
<p>Cargo does not have a way to say "build this binary and make it available at build time", if that is what bazel dose with <code>wasm-bindgen-cli = "=0.2.48"</code> then it is not reading Cargo.toml correctly.</p>



<a name="210288171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210288171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210288171">(Sep 16 2020 at 16:38)</a>:</h4>
<p>No</p>



<a name="210288176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210288176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210288176">(Sep 16 2020 at 16:38)</a>:</h4>
<p>that's not what Bazel does</p>



<a name="210288187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210288187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210288187">(Sep 16 2020 at 16:38)</a>:</h4>
<p>and that's not what <code>cargo-raze</code> is intending to do either</p>



<a name="210288249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210288249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210288249">(Sep 16 2020 at 16:39)</a>:</h4>
<p>it's attempting to take a dependency graph and generate bazel rules to build each dependency in the same way cargo would</p>



<a name="210288316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210288316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210288316">(Sep 16 2020 at 16:40)</a>:</h4>
<p>Ok, so far I am with you.</p>



<a name="210288373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210288373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210288373">(Sep 16 2020 at 16:40)</a>:</h4>
<p>so in the common case, this isn't an issue, because yeah, no one really depends on a binary</p>



<a name="210288435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210288435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210288435">(Sep 16 2020 at 16:41)</a>:</h4>
<p>I think it is stronger than that. depending on a binary, does nothing useful.</p>



<a name="210288443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210288443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210288443">(Sep 16 2020 at 16:41)</a>:</h4>
<p>but now there's a unique situation where we actually want to generate a binary target so we can use it in other bash/pwsh/batch commands</p>



<a name="210288634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210288634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210288634">(Sep 16 2020 at 16:43)</a>:</h4>
<p>the thing that seems most like what I want is <code>cargo tree</code>. And all <code>cargo raze</code> is trying to do is to recreate that same tree but in Bazel</p>



<a name="210288653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210288653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210288653">(Sep 16 2020 at 16:43)</a>:</h4>
<p>and <code>cargo tree</code> includes binary targets</p>



<a name="210289665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210289665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210289665">(Sep 16 2020 at 16:51)</a>:</h4>
<p>If you want to depend on that binary I think you will need to check out its repo/.crate and run <code>cargo metadata</code> there.<br>
I have to go to a meeting, but hopefully Eric with jump in to determine what parts are currently buggy.</p>



<a name="210289831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210289831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210289831">(Sep 16 2020 at 16:53)</a>:</h4>
<p><span class="user-mention" data-user-id="120179">@Eh2406</span> Thanks for your time and attention! <span aria-label="pray" class="emoji emoji-1f64f" role="img" title="pray">:pray:</span></p>



<a name="210290652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210290652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210290652">(Sep 16 2020 at 17:00)</a>:</h4>
<p>And all your help! <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="210293176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210293176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Philipp Oppermann <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210293176">(Sep 16 2020 at 17:20)</a>:</h4>
<p>The approach I use for <a href="https://github.com/rust-osdev/bootloader">https://github.com/rust-osdev/bootloader</a> is to add a library alongside the binary. In our case, the library is actually needed, but I guess you could also create an empty-dummy library for your use-case (it might be difficult to persuade the wasm-bindgen-cli maintainers of this though).</p>
<p>Since the crate now includes a library, it is present in the <code>cargo metadata</code> output. Through its <code>manifest_path</code> key, you get the path to the crate downloaded by cargo. This includes all binaries, so you can compile and run them by invoking <code>cargo build/run --manifest-path […] --target-dir […]</code>. The <code>--target-dir</code> argument is important because you don't want to put your compiled files into the cargo download location.</p>



<a name="210309492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210309492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210309492">(Sep 16 2020 at 19:34)</a>:</h4>
<p><span class="user-mention" data-user-id="343063">@UebelAndre</span> It sounds like you might be trying to express dependencies in <code>Cargo.toml</code> that aren't actually usable by Cargo, in the hopes that another tool (bazel) can use them.</p>



<a name="210309530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210309530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210309530">(Sep 16 2020 at 19:34)</a>:</h4>
<p>I'd love to see Cargo enhanced to support dependencies on binary crates.</p>



<a name="210309540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210309540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210309540">(Sep 16 2020 at 19:34)</a>:</h4>
<p>But it currently doesn't.</p>



<a name="210310311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210310311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210310311">(Sep 16 2020 at 19:41)</a>:</h4>
<p>Yeah, at this point I'm just trying to understand all the tools available to me at this point. I still need to go read what <code>cargo tree</code> is doing and why that's able to see all the targets. In this case "dependencies" aren't really "dependencies" but instead a list of crates to transitively pull. I think at this point I have all the information I need though so thank you everyone! <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="210310826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210310826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210310826">(Sep 16 2020 at 19:45)</a>:</h4>
<p>But my guess is that <code>cargo tree</code>'s behavure is a bug. Whether it is worth fixing, or waiting for a defined semantics <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span></p>



<a name="210310952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210310952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210310952">(Sep 16 2020 at 19:46)</a>:</h4>
<p>Is it a bug, or a side effect of our current handling of dependencies on crates that have both a binary and a library?</p>



<a name="210310979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210310979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210310979">(Sep 16 2020 at 19:46)</a>:</h4>
<p>Yes?</p>



<a name="210310985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210310985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210310985">(Sep 16 2020 at 19:46)</a>:</h4>
<p>(Either way, I do think it'd be appropriate to fix it.)</p>



<a name="210311207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210311207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210311207">(Sep 16 2020 at 19:48)</a>:</h4>
<p>Like <code>tree</code> and <code>metadata</code> should match.</p>



<a name="210311259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210311259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210311259">(Sep 16 2020 at 19:48)</a>:</h4>
<p>Can someone make an issue ticket and link it here? <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="210315871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210315871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210315871">(Sep 16 2020 at 20:25)</a>:</h4>
<p>Oh, it's also worth noting that <code>cargo vendor</code> will pull binary dependencies</p>



<a name="210315996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210315996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210315996">(Sep 16 2020 at 20:26)</a>:</h4>
<p>That should likely be added to the ticket as well</p>



<a name="210316120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210316120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210316120">(Sep 16 2020 at 20:27)</a>:</h4>
<p>or would <code>cargo vendor</code>'s behavior be a bug?</p>



<a name="210316554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210316554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210316554">(Sep 16 2020 at 20:31)</a>:</h4>
<p>I added <code>vendor.output</code> to my example in: <a href="https://github.com/UebelAndre/cargo-metadata-test">https://github.com/UebelAndre/cargo-metadata-test</a></p>



<a name="210316754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210316754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210316754">(Sep 16 2020 at 20:32)</a>:</h4>
<p><span class="user-mention" data-user-id="120179">@Eh2406</span> <span class="user-mention" data-user-id="239881">@Josh Triplett</span> <span class="user-mention" data-user-id="120518">@Eric Huss</span> Curious on your thoughts for <code>vendor</code></p>



<a name="210318197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210318197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210318197">(Sep 16 2020 at 20:45)</a>:</h4>
<p>I think they should be consistent. I don't know how best to get there.</p>



<a name="210318603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210318603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210318603">(Sep 16 2020 at 20:48)</a>:</h4>
<p>I agree but so far <code>metadata</code> seems to be the inconsistent behavior here. Though that said, I think you guys have a better understanding of how things are and could better reason about how things should be. I would love to see an issue ticket so I can track this and see all the thoughts there. I think it's a better place for this conversation since it's gotten larger than I was hoping for</p>



<a name="210321037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Differences%20between%20tree%20and%20metadata%20commands/near/210321037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Differences.20between.20tree.20and.20metadata.20commands.html#210321037">(Sep 16 2020 at 21:11)</a>:</h4>
<p><a href="https://github.com/rust-lang/cargo/issues/8708">https://github.com/rust-lang/cargo/issues/8708</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>